<template>
  <div>
    <div>
      <div class="showall-wrap">
        <div class="showall-wrap-left">
          <p><b class="el-icon-bicycle"></b>热门推荐</p>
          <div class="showcard" v-for="(item, index) in yanchudata" @click="routeDetail(item.ids)">
            <div><el-image fit class="images-el" :src="item.haibao" lazy></el-image></div>
            <p>{{ item.title1 }}</p>
          </div>
        </div>
        <div class="showall-wrap-right">
          <p><b class="el-icon-s-shop"></b>最新开售</p>
          <div class="right-card">
            <div class="right-card-ine" v-for="(item, index) in yanchuright"@click="routeDetail(item.ids)">
              <div>
                <el-image fit="true" class="images-el" :src="item.haibao" lazy></el-image>
              </div>
              <div class="right-nei-tit">
                <span>{{ item.title1 }}</span>
                <span>{{ item.timer }}</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Showall",
  data() {
    return {
      yanchudata: [],
      yanchuright: [],
    };
  },
  components: {
  },
  methods: {
    getYanchu() {
      this.$http
        .get("/cat_yanchu")
        .then((res) => {
          this.yanchudata = res.data.data.splice(0, 33);
          this.yanchuright = res.data.data.splice(0, 11);
          // console.log(this.yanchuright);
        })
        .catch((err) => {
          console.log(err);
        });
    },
    routeDetail(ids){
      // console.log(ids);
      // this.$router.push({path:'/Yshow/detail?ids='+ids})
      let url = this.$router.resolve({path:'/Yshow/detail',query:{ids:ids}})
      window.open(url.href,'_black')
    }
  },
  created() {
    this.getYanchu();
  },
};
</script>

<style lang="scss" scoped>
.showall-wrap {
  width: 1180px;
  min-height: 600px;
  margin: 40px auto;
  display: flex;
  justify-content: space-between;
  .showall-wrap-left {
    width: 810px;
    min-height: 500px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    p {
      font-size: 20px;
      position: absolute;
      b {
        margin-right: 5px;
        color: red;
      }
    }
    .showcard:hover {
      box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    }
    .showcard {
      width: 194px;
      height: 270px;
      border: 1px solid rgb(209, 206, 206);
      border-radius: 5px;
      text-align: center;
      margin: 35px 3px 5px 0;
      > div {
        border-radius: 5px;
        width: 194px;
        height: 210px;
        overflow: hidden;
        .images-el {
          width: 194px;
          height: auto;
        }
      }

      p {
        margin-top: 5px;
        font-size: 14px;
        width: 166px;
        height: 40px;
        overflow: hidden;
      }
    }
  }
  .showall-wrap-right {
    width: 310px;
    min-height: 500px;
    p {
      font-size: 20px;
      position: absolute;
      b {
        margin-right: 5px;
        color: red;
      }
    }
    .right-card {
      width: 330px;
      min-height: 500px;
      margin: 35px 0 0 0;
      border: 1px solid rgb(218, 216, 216);
      border-radius: 5px;
      overflow: hidden;
      .right-card-ine:hover {
        transform: scale(1.05);
      }
      .right-card-ine {
        transition: all 0.3s;
        display: flex;
        /* justify-content: space-between; */
        align-items: center;
        width: 330px;
        height: 100px;
        background: #ffffff;
        border-bottom: 1px solid #f0e8e8;
        margin-bottom: 8px;
        > div {
          border-radius: 5px;
          width: 155px;
          height: 80px;
          overflow: hidden;
          .images-el {
            width: 120px;
            /* height: 80px; */
            border-radius: 5px;

            margin-left: 10px;
            border-radius: 5px;
          }
        }

        .right-nei-tit {
          /* height: 100%; */
          font-size: 15px !important;
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          padding: 5px 5px;
          span {
            font-size: 15px;
            margin: 5px 0;
          }
          span:nth-child(1) {
            overflow: hidden;
          }
          span:nth-child(2) {
            white-space: nowrap;
            font-size: 14px;
            color: #7e7979;
          }
        }
      }
    }
  }
}
</style>
